﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IDReadTester
{
    public partial class Form1 : Form                           
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            comReader1.ReadComplete -= new IDRead_CVR.ReadCompleteEventHandler(comReader1_ReadCompete);
            comReader1.ReadComplete += new IDRead_CVR.ReadCompleteEventHandler(comReader1_ReadCompete);
            comReader1.ReadCard(1001);

        }

        void comReader1_ReadCompete(IDRead_CVR.ReadCompleteEventArgs e)
        {
            if (e.ReadStateCode == "0")
            {
                MessageBox.Show(e.IDCardCode);
            }
            else
            {
                MessageBox.Show(e.ReadStateMessage);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            comReader1.Close();
        }
    }
}
